<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>锤子科技官方网站</title>

<style>
body{ background-color:#CFF;}
#menu1{
	margin-top: 30px;
	padding-bottom: 15px;

	height: 30px;
	box-shadow:0px 2px 1px -1px #999;
	          _webkit-box-shadow:0px 2px 1px -1px #999;
	          _moz-box-shadow:0px 2px 1px -1px #999;
}
#sortproducts{
	height: 30px;
	margin-bottom: 20px;
	margin-top: 15px;
}



#productsshow{
	background-color:#FFF;
	width:1100px;
}

#listproducts{

	
	width: 100%;
	border-collapse: collapse;
	margin: 0px;
	padding: 0px;
	text-align: center;
	vertical-align: middle;

}
.product td{

    width: 275px;
	height: 300px;
	border: 1px solid #CFF;
	-moz-box-shadow:3px 3px 3px rgba(187, 255, 255, 0.4) inset,
	                -3px -3px 3px rgba(187, 255, 255, 0.4) inset;           
	-webkit-box-shadow:3px 3px 3px rgba(187, 255, 255, 0.4) inset,
		               -3px -3px 3px rgba(187, 255, 255, 0.4) inset;       
	box-shadow:3px 3px 3px rgba(187, 255, 255, 0.4) inset,           
		       -3px -3px 3px rgba(187, 255, 255, 0.4) inset;
}

#listproducts img{
	width: 50px;
	height: 50px;
}



#aftersale{
	border: 1px solid rgba(187, 255, 255, 0.5);
	border-radius: 10px;
	margin-bottom:50px;
	margin-top:30px;
	height: 150px;
	width: 1100px;
	background-color:#FFF;
}
#aftersale table{
	width:1100px;
	text-align: center;
	vertical-align: middle;
}
#aftersale table td{
	width: 270px;
	padding: 3px;
}
#menu1 li, #sortproducts li{
	list-style: none;
	float: left;
	margin-right: 20px;
}
.product ul li{list-style: none;}

</style>

</head>

<body>

<?php
include "head.php";

include "mysql.php";
$aa = new mysql;
$aa->link("");
?>
<div id="tbody" style="width: 1100px; height: auto; margin: 0 auto; border: 0px solid #000">
    <div id="menu">
        <div id="menu1"> 
            <ul>
                
          <?php
		   
		    $query1 = "select * from product_class order by show_order";
			$result1 = $aa->excu($query1);
			while ($product_class = mysqli_fetch_array($result1, MYSQLI_ASSOC))	{	

		?>
                
                
                <li>
				<form action="" method="post">
                    <input name="name" type="submit" value="<?php echo $product_class['class_name']; ?>">
				
                </form>
                </li>
                
                
               <?php
			      }
	           	?> 
                
            </ul>
        </div>
        <div id="sortproducts">
            <ul>
                <li>综合排序</li><li>销量排序</li><li>价格由低到高</li><li>价格由高到低</li>
            </ul>
        </div>
    </div>
    
    
    <?php
	 
	
	     $name = $_POST['name'];
		 
		 $query2 = "select * from product_class where class_name = $name";
			$result2 = $aa->excu($query1);
			$result2 = mysqli_fetch_array($result2, MYSQLI_ASSOC);
			$classid = $result2['id'];
		 
		 
		 listproducts($classid);
        function listproducts($classid){
			 global $aa;
    ?> 
    
    <div id="productsshow">
      
    <table id="listproducts" class="product">
            <tr>
                
        <?php
		   if($classid == 1) {$query = "select * from product_info where hot = $classid order by class_id";}
		       else{ $query = "select * from product_info where class_id = $classid order by show_order";}
			$result = $aa->excu($query);
			$j=0;
			while ($product = mysqli_fetch_array($result, MYSQLI_ASSOC)){
				$j++;

		?>
       
                <td>
            <ul>
                <?php $img = $product['imgsrc'];  $img = explode("#", $img);  $num = count($img); 
				    for($i = 0; $i < $num; $i++){  ?>
                <li><a href=""><img src="<?php echo $img[$i]; ?>" /></a></li>
                <?php } ?>
            </ul>
            
            <p class="productname"><a href=""><?php echo $product['name']; ?></a></p>
            <p class="productintro"><a href=""><?php echo $product['intro']; ?></a></p>
            
            <p class="span_dot"><?php for($i = 0; $i < $num; $i++){  ?>
                                      <span></span>
                                <?php } ?>
            </p>
            
            <p class="productprice">￥<?php echo $product['price']; ?></p>
            
            <form method="post" action="">
            <a href="productshow.php?id=<?php echo $product['id']; ?>"><input type="submit" value="查看详情" id="showintro"></a>
            <input type="submit" value="加入购物车" id="addtocar">
            </form>
                </td>
             <?php
                 if($j%4 == 0){
			 ?>
                 </tr>
                 <tr>
            

        <?php
			      }
			}
		?>
        </table>

    </div>  
    
    <?php
			      }
	           	?>
    
    
    
    
      
    
    <div id="aftersale">
        <table>
            <tr>
                <td><a href=""><img src="img/service.png" alt="" /></a></td><td><img src="img/days7.png" alt="" /></td><td><img src="img/days15.png" alt="" /></td><td><img src="img/freeshipping.png" alt="" /></td>
            </tr>
            <tr>
                <td><a href=""><strong>在线客服</strong></a></td><td><strong>7天无理由退货</strong></td><td><strong>15天免费换货</strong></td><td><strong>满150元免运费</strong></td>
            </tr>
            <tr>
                <td><a href=""><small>周一至周日&nbsp;9:00-18:00</small></a></td><td><small>天无理由退货&nbsp;请放心购买</small></td><td><small>15天内如遇质量问题&nbsp;免费换货</small></td><td><small>全场使用顺丰快递</small></td>
            </tr>
        </table>
    </div>

</div>
<?php
include "foot.php";
?>
</body>
</html>